<template>
    <Layout>
        <h1>订单管理</h1>
        <p v-if="!order || order.length == 0">您还没有订单哦</p>
        <ul v-for="item in order">
            <li>{{ `${item.Id} - ${item.Customer.Name} - ${item.Produce.Name} - ${item.CreatedTime}` }}</li>
        </ul>
    </Layout>
</template>



<script>
// import axios from 'axios';
export default {
    metaInfo: {
        title: '订单管理'
    },
    data() {
        return {
            order: []
        }
    },
    created() {

    },
    async mounted() {
        // console.log(this.$route.params); // 路由内参数
        // console.log(this.$route.query); // ?后的参数
        const { id } = this.$route.params
        if (!/\d+/.test(id)) {
            alert('Id不正确');
            return;
        }
        const base = `http://120.26.200.109:5210`;
        const url = `${base}/WJ/Order/GetList`;
        const response = await fetch(url)
        const res = await response.json()
        this.order = res.Data;
        // this.order.push(id);
    }
}
</script>
